package com.googlecode.triples.resource;

import com.googlecode.triples.resource.model.Triples;
import com.googlecode.triples.resource.model.References;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.PathSegment;
import javax.ejb.Local;

@Local
@Path("/")
public interface TripleQueryResource {

	// query/object//attribute

	@GET
	@Path("object/{object}/attribute/{attribute}")
	@Produces("application/xml")
	public Triples find(@PathParam("object") String object, @PathParam("attribute") String attribute);

	@GET
	@Path("object/{object}/attribute/{attribute}/refs")
	@Produces("application/xml")
	public References findReferences(@PathParam("object") String object, @PathParam("attribute") String attribute);

	@GET
	@Path("{object}/attribute/{attribute}/count")
	@Produces("text/plain")
	public Long findCount(@PathParam("object") String object, @PathParam("attribute") String attribute);

	@GET
	@Path("object/{object}/attribute/{attribute}/value")
	@Produces("text/plain")
	public String findValue(@PathParam("object") String object, @PathParam("attribute") String attribute);

	@GET
	@Path("object/{object}/attribute/{attribute}/values")
	@Produces("text/plain")
	public String findValues(@PathParam("object") String object, @PathParam("attribute") String attribute);

	// query/object//attributes

	@GET
	@Path("object/{object}/{attributes:.*}")
	@Produces("application/xml")
	public Triples findRecursive(@PathParam("object") String object, @PathParam("attributes") PathSegment attributes);

	@GET
	@Path("object/{object}/{attributes:.*}/count")
	@Produces("text/plain")
	public int findRecursiveCount(@PathParam("object") String object, @PathParam("attributes") PathSegment attributes);

	// query/all

	@GET
	@Path("all")
	@Produces("application/xml")
	public Triples getAll();

	@GET
	@Path("all/refs")
	@Produces("application/xml")
	public References getAllReferences();

	@GET
	@Path("all/count")
	@Produces("text/plain")
	public Long getAllCount();
}
